<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>员工详情 - HRMS</title>
    <jsp:include page="../../include/head.jsp"/>
</head>
<body>
    <jsp:include page="../../include/header.jsp"/>
    
    <div class="container mt-4">
        <!-- 面包屑导航 -->
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="${pageContext.request.contextPath}/auth/index">首页</a></li>
                <li class="breadcrumb-item"><a href="${pageContext.request.contextPath}/hr/employee/list">员工管理</a></li>
                <li class="breadcrumb-item active" aria-current="page">员工详情</li>
            </ol>
        </nav>

        <!-- 错误信息显示 -->
        <c:if test="${not empty error}">
            <div class="alert alert-danger" role="alert">
                ${error}
            </div>
        </c:if>

        <!-- 员工基本信息 -->
        <div class="card mb-4">
            <div class="card-header">
                <h5 class="card-title mb-0">基本信息</h5>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <p><strong>员工ID：</strong>${employee.empId}</p>
                        <p><strong>姓名：</strong>${employee.empName}</p>
                        <p><strong>性别：</strong>${employee.getGenderDesc()}</p>
                        <p><strong>出生日期：</strong>
                            <fmt:formatDate value="${employee.empBirthDate}" pattern="yyyy-MM-dd"/>
                        </p>
                        <p><strong>身份证号：</strong>${employee.empIdcard}</p>
                    </div>
                    <div class="col-md-6">
                        <p><strong>手机号：</strong>${employee.empPhone}</p>
                        <p><strong>学历：</strong>${employee.empEducation}</p>
                        <p><strong>角色：</strong>${employee.getRoleName()}</p>
                        <p><strong>所属部门：</strong>${organization.orgName}</p>
                        <p><strong>薪酬标准ID：</strong>${employee.salaryStandardId}</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- 工作信息 -->
        <div class="card mb-4">
            <div class="card-header">
                <h5 class="card-title mb-0">工作信息</h5>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <p><strong>入职日期：</strong>
                            <fmt:formatDate value="${employee.empEntryDate}" pattern="yyyy-MM-dd"/>
                        </p>
                        <p><strong>状态：</strong>
                            <span class="badge ${employee.isActive() ? 'bg-success' : 'bg-danger'}">
                                ${employee.isActive() ? '在职' : '离职'}
                            </span>
                        </p>
                    </div>
                    <div class="col-md-6">
                        <p><strong>创建时间：</strong>
                            <fmt:formatDate value="${employee.empCreateTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </p>
                        <p><strong>最后更新：</strong>
                            <fmt:formatDate value="${employee.empUpdateTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </p>
                    </div>
                </div>
            </div>
        </div>


        <!-- 操作按钮 -->
        <div class="mt-4">
            <a href="${pageContext.request.contextPath}/hr/employee/list" class="btn btn-secondary">
                <i class="fas fa-arrow-left"></i> 返回列表
            </a>
        </div>
    </div>

</body>
</html>
